import { listGoodsNameOrderInfo } from "@/api/order/order.js";

const order = {
  state: {
    lotGoodsNamelist:[]
  },

  mutations: {
   
    SET_LotGoodsNames: (state, data) => {
      state.lotGoodsNamelist = data
    }
  },

  actions: {
      // 获取商品列表
    GetLotGoodsNamesList({ commit, state }) {
      if (!state.lotGoodsNamelist.length) {
        return new Promise((resolve, reject) => {
            listGoodsNameOrderInfo().then(res => {
            const lotGoodsNamelist = res.data
              commit('SET_LotGoodsNames',lotGoodsNamelist)
            resolve(res)
          }).catch(error => {
            reject(error)
          })
        })
      }
     
    },
  }
}

export default order
